package com.springboot.service.task;

import com.springboot.service.anno.DiyScheduled;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @author Administrator
 */
@Component(TestTask.BEAN_NAME)
@DiyScheduled()
//@Conditional(value = TaskFilterCondition.class)
public class TestTask {
    final static String BEAN_NAME = "testTask";

//    @Scheduled(fixedRate = 5 * 1000)
    @DiyScheduled(cron = "0/5 * * * * ?", taskCode = "五秒执行一次")
    public void test() {

        System.out.println("五秒定时器开始执行" + System.currentTimeMillis());
    }

    @DiyScheduled(cron = "0/8 * * * * ?", taskCode = "八秒执行一次")
    private void test2() {

        System.out.println("八秒定时器开始执行" + System.currentTimeMillis());
    }

}
